package com.yate.security.custom;

/**
 * @ Tool：IntelliJ IDEA
 * @ Author：云生
 * @ Date：2024-12-09-16:23
 * @ Version：1.0
 * @ Description：
 */

import com.yate.common.MD5.MD5;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;

/**
 * <p>
 * 密码处理
 * </p>
 *
 */
@Component
public class CustomMd5PasswordEncoder implements PasswordEncoder {

    public String encode(CharSequence rawPassword) {
        return MD5.encrypt(rawPassword.toString());
    }

    public boolean matches(CharSequence rawPassword, String encodedPassword) {
        return encodedPassword.equals(MD5.encrypt(rawPassword.toString()));
    }
}